﻿<Window x:Class="EpiNEXT.Presentation.Enter.EnterWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:EpiNEXT.Presentation.Enter"
        xmlns:pages="clr-namespace:EpiNEXT.Presentation.Enter.Pages"
        xmlns:applications="clr-namespace:EpiNEXT.Applications;assembly=EpiNEXT.Applications"
        xmlns:content="clr-namespace:EpiNEXT.Presentation.Enter.Content"
        xmlns:controls="clr-namespace:EpiNEXT.Presentation.Controls;assembly=EpiNEXT.Presentation.Controls"
        xmlns:converters="clr-namespace:EpiNEXT.Presentation.Controls.Converters;assembly=EpiNEXT.Presentation.Controls"
        xmlns:mui="http://firstfloorsoftware.com/ModernUI"
        Icon="App.ico"
        Title="Enter"
        Width="1024"
        Height="748"
        Closing="Window_Closing"
        WindowStartupLocation="CenterScreen"
        SnapsToDevicePixels="True">
    <Window.DataContext>
        <applications:ProjectViewModel />
    </Window.DataContext>
    <Border Background="{StaticResource NoiseBrush}">
        <Grid>
            <Grid.Background>
                <SolidColorBrush Color="#000000" Opacity="0.8" />
            </Grid.Background>

            <pages:DataEntry x:Name="dataEntry" Grid.Row="0" Grid.Column="0" Visibility="{Binding IsLoaded, Converter={StaticResource BooleanToVisibilityConverter}}" />

            <Grid x:Name="grdIntro" Grid.Row="0" Grid.RowSpan="100" Grid.Column="0" Grid.ColumnSpan="100" 
              Visibility="{Binding IsLoaded, Converter={StaticResource BooleanToCollapsedConverter}}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <Grid Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2">
                    <TextBlock HorizontalAlignment="Left" Margin="140, 10, 20, 20" FontWeight="Bold" FontSize="24" Foreground="{StaticResource MediumTextBrush}" />
                    <!-- Text="{Binding Source={x:Static p:Settings.Default}, Path=ApplicationName, Mode=OneWay, Converter={StaticResource UppercaseConverter}}" -->
                </Grid>

                <Grid x:Name="grdGettingStarted" Width="380" Grid.Column="0" Grid.Row="1">
                    <Grid.Style>
                        <Style TargetType="{x:Type Grid}">
                            <Style.Triggers>
                                <Trigger Property="Visibility" Value="Visible">
                                    <Trigger.EnterActions>
                                        <BeginStoryboard>
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0" />
                                                    <SplineDoubleKeyFrame KeyTime="00:00:00.300" Value="1" />
                                                </DoubleAnimationUsingKeyFrames>
                                                <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" DecelerationRatio="1" BeginTime="00:00:00" Duration="00:00:0.3">
                                                    <SplineThicknessKeyFrame KeyTime="00:00:00" Value="20,0,-20,0" />
                                                    <SplineThicknessKeyFrame KeyTime="00:00:0.3" Value="0,0,0,0" />
                                                </ThicknessAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </Trigger.EnterActions>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </Grid.Style>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0">
                        <Label HorizontalAlignment="Left" Margin="30, 0, 20, 0" FontSize="16" FontWeight="Bold" Foreground="{StaticResource DarkTextBrush}">GETTING STARTED</Label>
                    </StackPanel>
                    <Grid Grid.Row="1" Margin="30, 6, 60, 20">
                        <Grid.Background>
                            <VisualBrush TileMode="Tile" Viewport="0,0,5,5" ViewportUnits="Absolute" Viewbox="0,0,5,5" ViewboxUnits="Absolute">
                                <VisualBrush.Visual>
                                    <Canvas>
                                        <Rectangle Fill="{StaticResource ContentBackgroundBrush}" Width="6" Height="6" />
                                       
                                    </Canvas>
                                </VisualBrush.Visual>
                            </VisualBrush>
                        </Grid.Background>
                         <StackPanel Margin="10">
                            <TextBlock Margin="15" Foreground="{StaticResource MediumTextBrush}" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="20" Text="Select an EpiNEXT project from the list to the right, or browse to find other data sources." />
                            <StackPanel Height="10" />
                            
                            <StackPanel Height="1" Background="{StaticResource DarkTextBrush}" />
                            <StackPanel Height="20" />
                            <Grid HorizontalAlignment="Left" Background="Transparent" >
                                <Grid.Style>
                                    <Style TargetType="{x:Type Grid}">
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Background">
                                                    <Setter.Value>
                                                        <SolidColorBrush Opacity="0.5" Color="Silver" />
                                                    </Setter.Value>
                                                </Setter>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Grid.Style>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="46" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Path Width="22" Height="22" Stretch="Fill" Fill="{StaticResource AccentBrush}" Data="F1 M 21,30.0001L 55.9999,30.0001L 55.9999,50L 21,50L 21,30.0001 Z M 52,28L 37,28C 38,25 39.4999,24.0001 39.4999,24.0001L 50.75,24C 51.3023,24 52,24.6977 52,25.25L 52,28 Z M 53.5,52C 54.8807,52 56,53.1193 56,54.5C 56,55.8807 54.8807,57 53.5,57C 52.1193,57 51,55.8807 51,54.5C 51,53.1193 52.1193,52 53.5,52 Z M 46.5,52C 47.8807,52 49,53.1193 49,54.5C 49,55.8807 47.8807,57 46.5,57C 45.1193,57 44,55.8807 44,54.5C 44,53.1193 45.1193,52 46.5,52 Z M 39.5,52C 40.8807,52 42,53.1193 42,54.5C 42,55.8807 40.8807,57 39.5,57C 38.1193,57 37,55.8807 37,54.5C 37,53.1193 38.1193,52 39.5,52 Z "/>
                                <Path Grid.Column="0" Width="38" Height="38" Stretch="Fill" Fill="{StaticResource AccentBrush}" Data="F1 M 38,0.791664C 58.5496,0.791664 75.2083,17.4504 75.2083,38C 75.2083,58.5496 58.5496,75.2083 38,75.2083C 17.4504,75.2083 0.791662,58.5496 0.791662,38C 0.791662,17.4504 17.4504,0.791664 38,0.791664 Z M 38,5.54166C 20.0738,5.54166 5.54167,20.0738 5.54167,38C 5.54167,55.9262 20.0738,70.4583 38,70.4583C 55.9262,70.4583 70.4583,55.9262 70.4583,38C 70.4583,20.0738 55.9262,5.54166 38,5.54166 Z "/>

                                <TextBlock Foreground="{StaticResource DarkTextBrush}" Grid.Column="1" VerticalAlignment="Center" FontSize="16" FontWeight="Bold" Margin="10, 0, 0, 2" Text="Browse" />
                            </Grid>

                            <StackPanel Height="20" />
                            <Grid HorizontalAlignment="Left" Background="Transparent" MouseDown="Grid_MouseDown" >
                                <Grid.Style>
                                    <Style TargetType="{x:Type Grid}">
                                        <Style.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter Property="Background">
                                                    <Setter.Value>
                                                        <SolidColorBrush Opacity="0.5" Color="Silver" />
                                                    </Setter.Value>
                                                </Setter>
                                            </Trigger>
                                        </Style.Triggers>
                                    </Style>
                                </Grid.Style>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="46" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Path Width="22" Height="22" Stretch="Fill" Fill="{StaticResource AccentBrush}" Data="F1 M 25.3333,52.25L 50.6666,52.25L 50.6666,45.9167L 55.4166,45.9167L 55.4166,57L 20.5833,57L 20.5833,45.9167L 25.3333,45.9167L 25.3333,52.25 Z M 34.8333,15.8333L 41.1667,15.8333L 41.1667,36.4167L 49.0833,26.9167L 49.0833,36.4167L 38,49.0833L 26.9167,36.4167L 26.9167,26.9167L 34.8333,36.4167L 34.8333,15.8333 Z "/>
                                <Path Grid.Column="0"  Width="38" Height="38" Stretch="Fill" Fill="{StaticResource AccentBrush}" Data="F1 M 38,0.791664C 58.5496,0.791664 75.2083,17.4504 75.2083,38C 75.2083,58.5496 58.5496,75.2083 38,75.2083C 17.4504,75.2083 0.791662,58.5496 0.791662,38C 0.791662,17.4504 17.4504,0.791664 38,0.791664 Z M 38,5.54166C 20.0738,5.54166 5.54167,20.0738 5.54167,38C 5.54167,55.9262 20.0738,70.4583 38,70.4583C 55.9262,70.4583 70.4583,55.9262 70.4583,38C 70.4583,20.0738 55.9262,5.54166 38,5.54166 Z "/>

                                <TextBlock Foreground="{StaticResource DarkTextBrush}" Grid.Column="1" VerticalAlignment="Center" FontSize="16" FontWeight="Bold" Margin="10, 0, 0, 2" Text="Import Epi Info Template" />
                            </Grid>
                        </StackPanel>
                    </Grid>
                </Grid>

                <Grid Grid.Column="1" Grid.Row="1" ClipToBounds="False">
                    <pages:Home x:Name="pageHome" ProjectOpened="Home_ProjectOpened" ClipToBounds="False" />
                    <pages:Forms x:Name="pageForms" FormOpened="Forms_FormOpened" BackButtonClicked="Forms_BackButtonClicked" Visibility="Collapsed" />
                </Grid>
            </Grid>

            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.RowSpan="100" Grid.ColumnSpan="100"
              Background="{StaticResource WindowBackgroundBrush}"
            Visibility="{Binding IsLoadingProject, Converter={StaticResource BooleanToVisibilityConverter}}">
                <Border BorderBrush="{StaticResource WindowBorderBrush}" BorderThickness="1" Background="{StaticResource ContentBackgroundBrush}"
                    HorizontalAlignment="Center" VerticalAlignment="Center"
                    >
                    <Grid x:Name="grdLoading" Grid.Row="0" Grid.RowSpan="100" Grid.Column="0" Grid.ColumnSpan="100" 
                  HorizontalAlignment="Center" VerticalAlignment="Center">
                        <StackPanel Margin="20">
                            <TextBlock Style="{StaticResource Heading1}" HorizontalAlignment="Center">Loading...</TextBlock>
                            <StackPanel Height="10" />
                            <ProgressBar IsIndeterminate="True" Width="400" Height="20" Margin="20" />
                        </StackPanel>
                    </Grid>
                </Border>
            </Grid>

            <pages:PrintViewer x:Name="printViewer" Grid.RowSpan="100" Grid.ColumnSpan="100" 
              Visibility="{Binding IsShowingPrintPreview, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}" />

        </Grid>
    </Border>
</Window>